package cc.wsyw126.server.controller;

import cc.wsyw126.nettyRPC.discovery.RpcProxy;
import cc.wsyw126.service.Login;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by Administrator on 2017/7/6.
 */
@Controller
public class LoginController {

    @Autowired
    private RpcProxy rpcProxy;


    @RequestMapping(value = "/login/{name}", method = RequestMethod.GET)
    @ResponseBody
    public String valid(@PathVariable String name){
        Login login = rpcProxy.create(Login.class);
        boolean valid = login.valid(name);
        return valid ? "welcome" : "wrong place";
    }
}
